<?php
ob_start();
session_start();
//	include("configuration/DbConn.php"); 
	include_once("UserIncludes/DbConfig.php");
				## Setup Database Connection
//	include("configuration/setvariables.php");  ## Set Variables

$fcomtid=$_REQUEST['id'];
$xml='<?xml version="1.0" encoding="ISO-8859-1"?>';
$xml.='<rss version="2.0">
<channel>
<title>RSS For Landing Page </title>
<link>http://esolz.org</link>
<generator>http://esolz.org</generator>
<webMaster>admin@esolz.org</webMaster>';

//$SQL1="SELECT * from forum_posts where status='1' and topicId='".$fcomtid."'";
echo $SQL1= "SELECT * FROM adspace_landing_page where landingId='".$fcomtid."' ";
$RS1=mysql_query($SQL1) or die(mysql_error());
$ROW1=mysql_fetch_array($RS1);
$rss_no=$ROW1['rss_no'];
for($i=0;$i<$rss_no;$i++)
{
$xml.='
<item>
<title>'.$ROW1['pageName'].'</title>

<description>'.ucfirst(stripslashes(strip_tags($ROW1['pageTitle']))).'</description>
<link>'.$GLOBALS['SiteUrl'].'rss_details.php?landingId='.$ROW1['landingId'].'</link>
</item>
';
}
$xml.='
</channel>
</rss>';
$xml=str_replace("&","&amp;",$xml);
header("Content-type: text/xhtml+xml"); 
// echo trim($xml);


?>


<?php
 $filename = 'rss.xml';
$somecontent = $xml;

if (is_writable($filename)) {

   if (!$handle = fopen($filename, 'w+')) {
        echo "Cannot open file ($filename)";
        exit;
   }

   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
   }

   echo "Success, wrote ($somecontent) to file ($filename)";

   fclose($handle);

} else {
   echo "The file $filename is not writable";
}
header("location:rss.xml"); 
?>